#include "header/pyramid_particles.h"

NodePtr createParticleSystem()
{
	NodePtr nParticleSys = Node::create();
	ParticlesPtr pParticleSys = Particles::create();
	 
	beginEditCP(nParticleSys);
		nParticleSys->setCore( pParticleSys );
	endEditCP(nParticleSys);
	
	
	beginEditCP(pParticleSys);	
		// set mode of particles to small points
		pParticleSys->setMode(Particles::Points);
	endEditCP(pParticleSys);
	
	// create and set material
	SimpleMaterialPtr smParticles = SimpleMaterial::create();

    beginEditCP(smParticles, SimpleMaterial::DiffuseFieldMask | SimpleMaterial::LitFieldMask);
    	smParticles->setLit(false);
    	//smParticles->setDiffuse(Color3f(0,1,0));
    endEditCP  (smParticles, SimpleMaterial::DiffuseFieldMask | SimpleMaterial::LitFieldMask);
  
	beginEditCP(pParticleSys, Geometry::MaterialFieldMask);
		pParticleSys->setMaterial( smParticles );
	endEditCP(pParticleSys, Geometry::MaterialFieldMask);
	
	
	return nParticleSys;
}

